$(function () {
    findProductClassify();
})
function findProductClassify() {
    let data = myAjax('/back/product/findProductClassify','','get');
    data=data.model;
    let html='';
    for (let i=0;i<data.length;i++){
        html +=' <option value="'+data[i].id+'">' + data[i].name + '</option>';
    };
    $("#productClassify").html(html);
}
function submitProduct() {
    let data1 = new FormData();
    data1.append("classify",$("#productClassify").val());
    data1.append("name",$("#product-name").val());
    data1.append("img",$("#product-img")[0].files[0]);
    data1.append("content",$("#product-description").val());
    data1.append("diliver",$("#diliver").val());
    data1.append("averageprice",$("#averageprice").val());
    data1.append("price",$("#price").val());
    data1.append("quality",$("#quality").val());
    data1.append("payment",$("#payment").val());
    data1.append("information",$("#information").val());
    let data = myFileAjax('/back/product/addProduct',data1,'post');

    if (data.result==1){
        alert("添加成功");
    }else {
        alert("添加失败");
    };
}